﻿
Partial Class Usercontrols_Security_Verification
	Inherits UserControlBase

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		If String.IsNullOrEmpty(Request.QueryString("ID")) Then
			Me.uxVerificationMessageLabel.Text = Resources.Resource.VerificationError1
		Else
			Dim userId As Guid

			Try
				userId = New Guid(Request.QueryString("ID"))
			Catch
				Me.uxVerificationMessageLabel.Text = Resources.Resource.VerificationError2
				Return
			End Try

			Dim usr As MembershipUser = Membership.GetUser(userId)
			If usr Is Nothing Then
				Me.uxVerificationMessageLabel.Text = Resources.Resource.VerificationError3
			Else
				usr.IsApproved = True
				Membership.UpdateUser(usr)

				Me.uxVerificationMessageLabel.Text = String.Format(Resources.Resource.VerificationSuccess, Request.ServerVariables("HTTP_HOST"), Request.ServerVariables("URL"), Resources.Resource.Login)
			End If
		End If
	End Sub

End Class
